import cn.hutool.core.lang.UUID;
import cn.hutool.jwt.JWT;
import cn.hutool.jwt.JWTUtil;

import java.util.HashMap;
import java.util.Map;

public class Jwt {
	public static void main(String[] args) {
		Map<String, Object> map = new HashMap<String, Object>() {
			private static final long serialVersionUID = 1L;

			{
				put("uid", UUID.randomUUID().toString());
				put("expire_time", System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 15);
			}
		};

		String token = JWTUtil.createToken(map, "1234".getBytes());
		System.out.println(token);

		final JWT jwt = JWTUtil.parseToken(token);
		System.out.println(jwt.getHeader());

		System.out.println(jwt.getPayload("uid"));
		System.out.println(JWTUtil.verify(token, "1234".getBytes()));
	}
}
